﻿using System;
using System.Net;
using System.IO;

namespace NeroConnect.Network
{
	/// <summary>Provides an HTTP-specific implementation of the System.Net.WebResponse class.</summary>
	public interface IResponse
	{
		/// <summary>Gets the headers that are associated with this response from the server.</summary>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		WebHeaderCollection Headers { get; }

		/// <summary>Gets or sets the cookies that are associated with this response.</summary>
		/// <value>A System.Net.CookieCollection that contains the cookies that are associated with this response.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		CookieCollection Cookies { get; }
		
		/// <summary>Gets the status of the response.</summary>
		/// <value>One of the System.Net.HttpStatusCode values.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		HttpStatusCode StatusCode { get; }

		/// <summary>Gets the status description returned with the response.</summary>
		/// <value>A string that describes the status of the response.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		string StatusDescription { get; }

		/// <summary>Gets the URI of the Internet resource that responded to the request.</summary>
		/// <value>A System.Uri that contains the URI of the Internet resource that responded to the request.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		Uri ResponseUri { get; }

		/// <summary>Gets the content type of the response.</summary>
		/// <value>A string that contains the content type of the response.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		string ContentType { get; }

		/// <summary>Gets the length of the content returned by the request.</summary>
		/// <value>The number of bytes returned by the request. Content length does not include header information.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		long ContentLength { get; }

		/// <summary>Gets the method that is used to encode the body of the response.</summary>
		/// <value>A string that describes the method that is used to encode the body of the response.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		string ContentEncoding { get; }

		/// <summary>Gets the name of the server that sent the response.</summary>
		/// <value>A string that contains the name of the server that sent the response.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		string Server { get; }

		/// <summary>Gets the last date and time that the contents of the response were modified.</summary>
		/// <value>A System.DateTime that contains the date and time that the contents of the response were modified.</value>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		DateTime LastModified { get; }

		/// <summary>Gets the stream that is used to read the body of the response from the server.</summary>
		/// <returns>A System.IO.Stream containing the body of the response.</returns>
		/// <exception cref="System.Net.ProtocolViolationException">There is no response stream.</exception>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
		Stream GetResponseStream();

		/// <summary>Gets the contents of a header that was returned with the response.</summary>
		/// <param name="headerName">The header value to return.</param>
		/// <returns>The contents of the specified header.</returns>
		/// <exception cref="System.ObjectDisposedException">The current instance has been disposed.</exception>
		string GetResponseHeader(string headerName);

		/// <summary>Closes the response stream.</summary>
		void Close();
	}
}
